# Maintainer:
pkgname=virtiofsd
pkgver=1.9.0
pkgrel=1
pkgdesc="virtio-fs vhost-user device daemon"
url="https://gitlab.com/virtio-fs/virtiofsd"
# fails to build on 32-bit
arch="all !x86 !armhf !armv7"
license="Apache-2.0 AND BSD-3-Clause"
makedepends="
	cargo
	cargo-auditable
	libcap-ng-dev
	libseccomp-dev
	"
source="https://gitlab.com/virtio-fs/virtiofsd/-/archive/v$pkgver/virtiofsd-v$pkgver.tar.bz2
	50-virtiofsd.json
	lfs64.patch
	"
builddir="$srcdir/virtiofsd-v$pkgver"
options="net"

# qemu doesn't ship this anymore, split to this project
provides="qemu-virtiofsd=$pkgver-r$pkgrel"
replaces="qemu-virtiofsd"

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --release --frozen
}

check() {
	cargo test --frozen --release
}

package() {
	install -Dm755 target/release/virtiofsd \
		-t "$pkgdir"/usr/lib/qemu/
	install -Dm644 "$srcdir"/50-virtiofsd.json \
		-t "$pkgdir"/usr/share/qemu/vhost-user/
}

sha512sums="
f986423452f1a232466fb948d6c56991678a34fb701d631aa4fa7a9e3a805f4aeb22fe2edb3c115ef2254409ce7d9bd148f6d4422cb3a2bd0fa94048550b7d62  virtiofsd-v1.9.0.tar.bz2
32c6f218980ff4fe5b7d6e21eadc64927142f9e128e6abe749d486cf02e7daf3ed285fedb757a43811b6161a522885e7f19d0e9f069ba97aaabbbc55560aad88  50-virtiofsd.json
a7a92300da2457a74aef7538c79a3ed5833fa511a399cfe4165fe6af16586de34c93570dd0b14e7325accb22cd9e5695dc32a0e425c7daf1b3b13214004f1fc3  lfs64.patch
"
